/*
 * @Author: Wangtao
 * @Date: 2022-08-22 23:00:38
 * @LastEditors: Wangtao
 * @LastEditTime: 2022-09-01 15:43:59
 */
import fetch from '@/common/utils/http'

export interface loginParams {
  loginName: string
  domain?: string
  password: string
  clientType?: number
}

export const login = (data?: loginParams) =>
  fetch({
    url: '/platform/public/login',
    method: 'POST',
    data: data || {}
  })

export const getPlatformInfo = (data?: any) =>
  fetch({
    url: '/platform/public/info',
    method: 'GET',
    params: data || {}
  })

export const getLoginInfo = (data?: any) =>
  fetch({
    url: '/platform/action/loginInfo',
    method: 'GET',
    params: data || {}
  })

// 获取登陆公钥
export const getLoginPre = (data?: any) =>
  fetch({
    url: '/platform/public/loginPre',
    method: 'GET',
    params: data || {}
  })

// 获取socket连接 token
export const refreshWsToken = (data?: any) =>
  fetch({
    url: '/platform/action/refreshWsToken',
    method: 'GET',
    params: data || {}
  })

// 退出登录
export const logOut = (data?: any) =>
  fetch({
    url: '/platform/action/webLogout',
    method: 'post',
    data
  })
